The QinQ technology is a visualized name of a tunneling protocol based on a two-layer 802.1Q encapsulation, its core idea is to encapsulate the Virtual Local Area Network Tag (VLAN tag) of the user network to the VLAN tag of the backbone network such as the operator network or the Internet Service Provider (ISP) network, and the message is passing through the backbone network with two layers of VLAN Tag.
The port in the Backbone for the user access is called as the user port. When the source user network interconnects with the destination user network through the backbone network, after a user message (the message is in the common format) is received at the user port, a new layer of VLAN Tag (the backbone network VLAN Tag) is encapsulated on the basis of the message's original VLAN Tag (user network VLAN Tag), that is, “Add QinQ” encapsulation to the message. Thereafter, the QinQ encapsulated message is transmitted. Before the message is sent to the destination user network by another user port in the backbone network, the encapsulation of the added backbone network VLAN Tag is removed to restore the message to be in the common format, that is “remove the QinQ” encapsulation. At this point, the message received by the destination user network is consistent with the message sent by the source user network.
Since the backbone network might encounter the link switching during the transmission process, it needs to transform the VLAN Tag in order to continue to transmit messages in the link after the switching. Moreover, when it needs to make different processing on the message, it also needs to transform the VLAN Tag, that is, transform the QinQ encapsulation to adapt to the new link.
FIG. 1 is a schematic diagram of the QinQ encapsulation format, and the QinQ encapsulation format comprises: the destination Media Access Control (MAC) address (DA), the source MAC address (SA), the outer VLAN Tag (Stag, Service tag), the inner VLAN Tag (Ctag, Customer tag), Type/Length, payload and cyclic redundancy check (CRC). Wherein, both the Stag and the Ctag comprise: Tag Protocol Identification (TPID) and tag control information (TCI).
The TPID is a tag used to identify the received messages between different network devices in the network interconnection, in a mature protocol, the TPID might be a standard protocol number, for example, the TPID in the inner VLAN Tag of the QinQ protocol has the standard protocol number 8100, the TPID in the outer VLAN Tag of the QinQ protocol currently has no fixed standard protocol number so far. The TCI generally comprises three aspects of content: priority, VLAN identification (VLAN ID) and canonical format indicator (CFI). Wherein, the priority is used to specify the priority level of the current message frame, generally there are eight priority levels; the VLAN ID is used to specify the VLAN that the current message belongs to.
Typically, the QinQ only supports simple configuration strategy based on the outer VLAN Tag or a combination of the outer VLAN Tag and the user port, that is, the outer VLAN Tag of the received message or a combination of the outer VLAN Tag and the user port is taken as the identification to add an encapsulation to the message, remove the encapsulation of the message or transform the encapsulation of the message. However, in practical applications, it might need to implement more configuration strategies on the QinQ, for example, perform operations such as adding encapsulation, removing the encapsulation or transforming the encapsulation, and so on according to the outer VLAN Tag and the priority of the message, or according to the outer VLAN Tag and the customer VLAN tag, or according to the service VLAN tag, the inner VLAN Tag and the priority, and so on, therefore, the concept of flexible QinQ appears, and the flexible QinQ supports enriched configuration strategies.
Currently, the flexible QinQ has no fixed service TPID standard protocol number, therefore, when implementing the flexible QinQ in the prior art, different manufacturers usually have different values set for the service TPID, therefore, in practical applications, there will have situations that the service TPIDs are not compatible with each other. Moreover, in order to achieve the flexible QinQ technology, generally a network processor (NP) is used in the prior art to deploy the QinQ configuration strategy and store a variety of required data. The NP uses a special memory to place the required data information in a table, supports to search for the address based on the content, and can retrieve information with relatively long length, but the price of the NP itself is relatively high, thus the cost of this implementation is relatively high, which is not conducive to market competition.
The specification of the Chinese patent application whose application number is 200610138023.4 disclosed a method and device for implementing flexible QinQ, and this method comprising: presetting a QinQ table in a chip, storing the data required by the flexible QinQ configuration strategy, receiving messages, query in the data needed by the flexible QinQ configuration strategy according to the customer VLAN ID, the service VLAN ID and the priority of a received message; obtain the required data from the flexible QinQ configuration strategy data through the query, and use the obtained data to execute the QinQ operation on the message.
The defects of the aforementioned method are: for each received message, a linear combination or a HASH operation result of the customer VLAN ID, the service VLAN ID and the priority should be used as an index to search for the data required by the flexible QinQ configuration strategy, the method of linear combination increases the amount of memory usage, this is because of that the two VLAN IDs and the priorities occupy 27 bits, while the linear index table also takes up to 134 M bytes of memory space. The mode of Hash operation is more feasible, but the data in the QinQ table have been stored in the chip before processing the messages. Regardless of using the table entries or not, they can be polled when looking up the table, therefore, query of the QinQ table is a massive query in practical applications, and if each received message needs a massive query in the QinQ table, it will significantly consume the processor and memory resources, and is very inefficient, moreover, no matter what method is used to query the QinQ table, the purpose of forwarding messages with high flow wire-speed is hard to be achieved.